.TH std::extents::extent 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::extents::extent \- std::extents::extent

.SH Synopsis
   constexpr index_type extent( rank_type i ) const noexcept;  (since C++23)

   Returns dynamic extent size of an extents at a certain rank index.

.SH Parameters

   i - The rank index to get the extent size of

.SH Return value

   The dynamic extent size of an extents at a certain rank index.

.SH Example


// Run this code

 #include <iostream>
 #include <mdspan>

 int main()
 {
     std::extents<int, 1, 2> e1;
     std::extents<int, 3, std::dynamic_extent, std::dynamic_extent> e2(4, 5);
     std::cout << e1.extent(0) << ", " << e1.extent(1) << '\\n';
     std::cout << e2.extent(0) << ", " << e2.extent(1) << ", " << e2.extent(2) << '\\n';
 }

.SH Output:

 1, 2
 3, 4, 5

.SH See also

   static_extent returns static extent size of an extents at a certain rank index
   \fB[static]\fP      \fI(public static member function)\fP
   extent        obtains the size of an array type along a specified dimension
   \fI(C++11)\fP       \fI(class template)\fP
